#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

#rm -fr log.*
./Allclean

# create the underlying block mesh
runApplication blockMesh

# create burner patch
runApplication setSet -batch system/burner.setSet
mv log.setSet log.burnerRegion.setSet
#  rm -f constant/polyMesh/sets/*_old
#  runApplication setsToZones -noFlipMap
#  mv log.setsToZones log.setsToZones.burnerRegion
runApplication createPatch -overwrite
mv log.createPatch log.createPatch.burnerRegion

# create pyrolysis zone
runApplication setSet -batch system/pyrolysis.setSet
mv log.setSet log.pyrolysisRegion.setSet
#   rm -f constant/polyMesh/sets/*_old
#   runApplication setsToZones -noFlipMap
#   mv log.setsToZones log.setsToZones.pyrolysisRegion

# extrude film region
runApplication extrudeToRegionMesh17x -overwrite -dict extrudeToRegionMeshDictFilm
mv log.extrudeToRegionMesh17x log.filmRegion.extrudeToRegionMesh17x

# extrude pyrolysis region
#runApplication setSet -batch system/panel.setSet

runApplication extrudeToRegionMesh17x -overwrite -dict extrudeToRegionMeshDictPyr
mv log.extrudeToRegionMesh17x log.pyrolysisRegion.extrudeToRegionMesh17x

####################################################################
#create film patch
runApplication setsToZones -noFlipMap
mv log.setsToZones log.setsToZones.primaryRegion

runApplication setSet -region filmRegion -batch system/createFilmRegionPatches.setSet
mv log.setSet log.createFilmRegionPatches.setSet

runApplication setsToZones -noFlipMap -region filmRegion
mv log.setsToZones log.setsToZones.filmRegion

runApplication createPatch -region filmRegion -overwrite
mv log.createPatch log.createPatch.filmRegion

runApplication changeDictionary -region filmRegion
mv log.changeDictionary log.changeDictionary.filmRegion

runApplication changeDictionary 
mv log.changeDictionary log.changeDictionary.primaryRegion

exit;
